package com.hxc.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hxc.mapper.UserMapper;
import com.hxc.pojo.User;
import com.hxc.service.UserService;
import com.hxc.vo.UserVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    UserMapper userMapper;

    @Override
    public PageInfo<User> listAll(UserVo userVo, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<User> list = userMapper.listAll(userVo);
        return new PageInfo<>(list);
    }

    @Override
    public int updateUser(User user) {
        return userMapper.updateUser(user);
    }

    @Override
    public int delUser(Integer[] ids) {
        return userMapper.delUser(ids);
    }

    @Override
    public User getUser(Integer id) {
        return userMapper.getUser(id);
    }
}
